package com.offcn.uquestion;

public class aa {
        public static int countPaths(int n) {
            int[][] dp = new int[n][n];
            // 初始化第一行和第一列
            for (int i = 0; i < n; i++) {
                dp[0][i] = 1;
                dp[i][0] = 1;
            }
            // 计算其他位置的走法总数
            for (int i = 1; i < n; i++) {
                for (int j = 1; j < n; j++) {
                    dp[i][j] = dp[i-1][j] + dp[i][j-1];
                }
            }
            return dp[n-1][n-1];
        }

        public static void main(String[] args) {
            int n = 3;
            System.out.println(countPaths(n)); // 输出70
        }
    }
